package org.apache.jsp.manager.sales;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;

public final class SalesList_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html;charset=euc-kr");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      java.util.Hashtable outputTable = null;
      synchronized (request) {
        outputTable = (java.util.Hashtable) _jspx_page_context.getAttribute("outputTable", PageContext.REQUEST_SCOPE);
        if (outputTable == null){
          outputTable = new java.util.Hashtable();
          _jspx_page_context.setAttribute("outputTable", outputTable, PageContext.REQUEST_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');
      java.util.Hashtable inputTable = null;
      synchronized (request) {
        inputTable = (java.util.Hashtable) _jspx_page_context.getAttribute("inputTable", PageContext.REQUEST_SCOPE);
        if (inputTable == null){
          inputTable = new java.util.Hashtable();
          _jspx_page_context.setAttribute("inputTable", inputTable, PageContext.REQUEST_SCOPE);
        }
      }
      out.write("\r\n");
      out.write("\r\n");

	String delivery_state = (String)inputTable.get("delivery_state");
	String productName = (String)inputTable.get("productName");
	ArrayList areaList = (ArrayList)outputTable.get("areaList");
	ArrayList salesList = (ArrayList)outputTable.get("salesList");
	
	String hidden = (String)inputTable.get("hidden");
	String sex = (String)inputTable.get("sex");
	String age = (String)inputTable.get("age");

      out.write("\r\n");
      out.write("<SCRIPT language=\"JavaScript\">\r\n");
      out.write("\r\n");
      out.write("\tfunction selectAction()\r\n");
      out.write("\t{\r\n");
      out.write("\t\tvar f = document.salesForm;\r\n");
      out.write("\r\n");
      out.write("\t\t\r\n");
      out.write("\t\tf.func.value = \"msales_002\";\t\r\n");
      out.write("\t\tf.submit();\r\n");
      out.write("\t}\r\n");
      out.write("\t// 상품명 검색\r\n");
      out.write("\tfunction findAction()\r\n");
      out.write("\t{\r\n");
      out.write("\t\tvar f = document.salesForm;\r\n");
      out.write("\r\n");
      out.write("\t\t// 입력여부 체크\r\n");
      out.write("\t\tif(f.productName.value==\"\")\r\n");
      out.write("\t\t{\r\n");
      out.write("\t\t\twindow.alert(\"상품 이름을 입력하세요.\");\r\n");
      out.write("\t\t\tf.productName.select();\r\n");
      out.write("\t\t\treturn false;\r\n");
      out.write("\t\t}\r\n");
      out.write("\r\n");
      out.write("\t\tf.productName.value = trim(f.productName.value);\r\n");
      out.write("\r\n");
      out.write("\t\twindow.open(\"/common/Progress.jsp\", \"productFind\", \"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=500, height=200\");\r\n");
      out.write("\r\n");
      out.write("\t\tf.func.value = \"msales_003\";\r\n");
      out.write("\t\tf.target = \"productFind\";\r\n");
      out.write("\t\tf.submit();\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("\tfunction todayAction()\r\n");
      out.write("\t{\r\n");
      out.write("\t\tvar f = document.salesForm;\r\n");
      out.write("\r\n");
      out.write("\t\tf.id.value = \"\";\r\n");
      out.write("\t\tf.date1.value = \"\";\r\n");
      out.write("\t\tf.date2.value = \"\";\r\n");
      out.write("\t\tf.hidden.value=\"TODAY\";\r\n");
      out.write("\t\tf.submit();\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("\tfunction monthAction1()\r\n");
      out.write("\t{\r\n");
      out.write("\t\tvar f = document.salesForm;\r\n");
      out.write("\t\tf.id.value = \"\";\r\n");
      out.write("\t\tf.date1.value = \"\";\r\n");
      out.write("\t\tf.date2.value = \"\";\r\n");
      out.write("\t\tf.hidden.value=\"MONTH1\";\r\n");
      out.write("\t\tf.submit();\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("\tfunction monthAction2()\r\n");
      out.write("\t{\r\n");
      out.write("\t\tvar f = document.salesForm;\r\n");
      out.write("\t\t\r\n");
      out.write("\t\tf.id.value = \"\";\r\n");
      out.write("\t\tf.date1.value = \"\";\r\n");
      out.write("\t\tf.date2.value = \"\";\r\n");
      out.write("\t\tf.hidden.value=\"MONTH2\";\r\n");
      out.write("\t\tf.submit();\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("\tfunction monthAction3()\r\n");
      out.write("\t{\r\n");
      out.write("\t\tvar f = document.salesForm;\r\n");
      out.write("\t\t\r\n");
      out.write("\t\tf.id.value = \"\";\r\n");
      out.write("\t\tf.date1.value = \"\";\r\n");
      out.write("\t\tf.date2.value = \"\";\r\n");
      out.write("\t\tf.hidden.value=\"MONTH3\";\r\n");
      out.write("\t\tf.submit();\r\n");
      out.write("\t}\t\r\n");
      out.write("</SCRIPT>\r\n");
      out.write("\t<BR>\r\n");
      out.write("\t<FORM name=\"salesForm\" action=\"/servlet/service.ManagerSalesServlet \" method=\"post\" onSubmit=\"return false;\">\r\n");
      out.write("\t<FONT face=\"돋움체\" size=\"4\" color=\"#484848\"><B>판매실적</B></FONT>\r\n");
      out.write("\t<FONT face=\"돋움체\" size=\"2\" color=\"#666666\">기간, 지역, 연령, 성별, 판매상품을 조합하여 조회 가능합니다.</FONT>\r\n");
      out.write("\t<BR>\r\n");
      out.write("\t<INPUT type=\"hidden\" name=\"hidden\" value=\"\">\r\n");
      out.write("\t<INPUT type=\"hidden\" name=\"func\" value=\"msales_002\">\r\n");
      out.write("\t<FIELDSET style=\"width:750; padding=10px\">\r\n");
      out.write("\t\t\t<DIV style=\"padding=2px\">\r\n");
      out.write("\t\t\t\t<TABLE width=\"700\" align=\"left\">\r\n");
      out.write("\t\t\t\t\t<TR>\r\n");
      out.write("\t\t\t\t\t\t<TD>\r\n");
      out.write("\t\t\t\t\t\t\t<FONT face=\"돋움체\" size=\"2\" color=\"#666666\">조회기간<IMG src=\"/images/manager/sales/bar.gif\"></FONT>\r\n");

				if (hidden!=null && hidden.equals("TODAY"))
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/today_btB.gif\" onclick=\"todayAction()\" style=\"cursor:hand\" ></IMG>\r\n");

				}
				else
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/today_btA.gif\" onclick=\"todayAction()\" style=\"cursor:hand\" ></IMG>\r\n");

				}
				if (hidden!=null && hidden.equals("MONTH1"))
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/1month_btB.gif\" onclick=\"monthAction1()\" style=\"cursor:hand\"  ></IMG>\r\n");

				}
				else
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/1month_btA.gif\" onclick=\"monthAction1()\" style=\"cursor:hand\" ></IMG>\r\n");

				}		
				if (hidden!=null && hidden.equals("MONTH2"))
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/2month_btB.gif\" style=\"cursor:hand\" onclick=\"monthAction2()\"></IMG>\r\n");

				}			
				else
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/2month_btA.gif\" onclick=\"monthAction2()\" style=\"cursor:hand\" ></IMG>\r\n");

				}		
				if (hidden!=null && hidden.equals("MONTH3"))
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/3month_btB.gif\" style=\"cursor:hand\" onclick=\"monthAction3()\"></IMG>\t\r\n");
			
				}
				else
				{

      out.write("\t\t\t\r\n");
      out.write("\t\t\t\t\t<IMG src=\"/images/manager/sales/3month_btA.gif\" onclick=\"monthAction3()\" style=\"cursor:hand\" ></IMG>\r\n");
		
				}

      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t<INPUT type=\"text\" size=\"10\" name=\"date1\">\r\n");
      out.write("\t\t\t\t\t\t\t<FONT face=\"돋움체\" size=\"4\" color=\"#666666\">~</FONT>\r\n");
      out.write("\t\t\t\t\t\t\t<INPUT type=\"text\" size=\"10\" name=\"date2\">\r\n");
      out.write("\t\t\t\t\t\t\t<IMG src=\"/images/manager/sales/select_bt.gif\" style=\"cursor:hand\" onclick=\"selectAction()\"></IMG>\r\n");
      out.write("\t\t\t\t\t\t</TD>\r\n");
      out.write("\t\t\t\t\t</TR>\r\n");
      out.write("\t\t\t\t\t<TR>\r\n");
      out.write("\t\t\t\t\t\t<TD>\r\n");
      out.write("\t\t\t\t\t\t\t<FONT face=\"돋움체\" size=\"2\" color=\"#666666\">판매상품<IMG src=\"/images/manager/sales/bar.gif\"></FONT>\r\n");
      out.write("\t\t\t\t\t\t\t<INPUT type=\"text\" size=\"20\" name=\"productName\" value='");
      out.print(productName );
      out.write("'> <INPUT type=\"button\" value=\"검색\" onclick=\"findAction()\">\r\n");
      out.write("\t\t\t\t\t\t</TD>\r\n");
      out.write("\t\t\t\t\t</TR>\r\n");
      out.write("\t\t\t\t\t<TR>\r\n");
      out.write("\t\t\t\t\t\t<TD>\r\n");
      out.write("\t\t\t\t\t\t\t<FONT face=\"돋움체\" size=\"2\" color=\"#666666\">추가옵션<IMG src=\"/images/manager/sales/bar.gif\"></FONT>\r\n");
      out.write("\t\t\t\t\t\t\t<SELECT name=\"delivery_state\">\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"\">지역</OPTION>\r\n");

							if (areaList != null && areaList.size()>0)
							{
								for (int i=0; i<areaList.size(); i++)
								{
									Hashtable areaTable = (Hashtable)areaList.get(i);
									String area_seq = (String)areaTable.get("SEQ");
									String area = (String)areaTable.get("DELIVERY_STATE");

      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t\t\t<OPTION ");
if (delivery_state.equals(area)){
      out.write("selected");
} 
      out.write('>');
      out.print(area );
      out.write("</OPTION>\r\n");

								}
							}

      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t</SELECT>\r\n");
      out.write("\t\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\t<SELECT name=\"age\">\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION ");
if (age.equals("")){
      out.write("selected");
}
      out.write(">연령</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"10\" ");
if (age.equals("10")){
      out.write("selected");
}
      out.write(">10대</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"20\"");
if (age.equals("20")){
      out.write("selected");
}
      out.write(">20대</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"30\"");
if (age.equals("30")){
      out.write("selected");
}
      out.write(">30대</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"40\"");
if (age.equals("40")){
      out.write("selected");
}
      out.write(">40대</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"50\" ");
if (age.equals("50")){
      out.write("selected");
}
      out.write(">50대</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t</SELECT>\r\n");
      out.write("\t\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\t<SELECT name=\"sex\">\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"\" ");
if (sex.equals("")){
      out.write("selected");
}
      out.write(">성별</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"M\" ");
if (sex.equals("남")){
      out.write("selected");
}
      out.write(">남</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t\t<OPTION value=\"F\"");
if (sex.equals("여")){
      out.write("selected");
}
      out.write(">여</OPTION>\r\n");
      out.write("\t\t\t\t\t\t\t</SELECT>\r\n");
      out.write("\t\t\t\t\t\t</TD>\r\n");
      out.write("\t\t\t\t\t</TR>\r\n");
      out.write("\t\t\t</TABLE>\r\n");
      out.write("\t</FIELDSET>\r\n");
      out.write("\t</FORM>\r\n");
      out.write("\t<BR><BR>\r\n");
      out.write("\r\n");
      out.write("\t<TABLE style=\"border-collapse:collapse;\" cellpadding=\"3\" cellspacing=\"0\" width=\"750\" border=\"1\" bordercolor=\"#BABABA\" frame=\"hsides\">\r\n");
      out.write("\t\t<TR  bgcolor=\"F9F9F9\">\r\n");
      out.write("\t\t\t<TD width=\"150\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">주문날짜</FONT></TD>\r\n");
      out.write("\t\t\t<TD width=\"150\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">주문번호</FONT></TD>\r\n");
      out.write("\t\t\t<TD width=\"50\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">성별</FONT></TD>\r\n");
      out.write("\t\t\t<TD width=\"50\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">연령</FONT></TD>\r\n");
      out.write("\t\t\t<TD width=\"250\" align=\"center\">  <FONT face=\"돋움체\" size=\"2\" color=\"#666666\">판매 상품</FONT></TD>\r\n");
      out.write("\t\t\t<TD width=\"100\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">순이익</FONT></TD>\r\n");
      out.write("\t\t</TR>\r\n");

if(salesList  != null && salesList.size() >0 )
{
	for (int i=0; i<salesList.size(); i++)
	{
		Hashtable salesTable = (Hashtable)salesList.get(i);
		String reg_date = (String)salesTable.get("REG_DATE");
		String seq = (String)salesTable.get("SEQ");
		String sex2  = (String)salesTable.get("SEX");
		String age2  = (String)salesTable.get("AGE");
		String name  = (String)salesTable.get("NAME");
		String profit  = (String)salesTable.get("PROFIT");
		String product = (String)salesTable.get("PRODUCT");

      out.write("\r\n");
      out.write("\t\r\n");
      out.write("\t<TR>\r\n");
      out.write("\t\t<TD width=\"150\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">\r\n");
      out.write("\t\t\t<A href=\"#\"><U>");
      out.print(reg_date );
      out.write("</U></A></FONT>\r\n");
      out.write("\t\t</TD>\r\n");
      out.write("\t\t<TD width=\"150\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">");
      out.print(seq);
      out.write("</FONT></TD>\r\n");
      out.write("\t\t<TD width=\"50\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">");
      out.print(sex2);
      out.write("</FONT></TD>\r\n");
      out.write("\t\t<TD width=\"50\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">");
      out.print(age2);
      out.write("</FONT></TD>\r\n");
      out.write("\t\t<TD width=\"250\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">");
      out.print(product);
      out.write("</FONT></TD>\r\n");
      out.write("\t\t<TD width=\"100\" align=\"center\"><FONT face=\"돋움체\" size=\"2\" color=\"#666666\">");
      out.print(profit);
      out.write("</FONT></TD>\r\n");
      out.write("\t</TR>\r\n");

	}
}
else
{

      out.write("\r\n");
      out.write("<TR>\r\n");
      out.write("\t<TD  colspan=\"6\" align=\"center\">\r\n");
      out.write("\t\t조회된 데이터가 없습니다.\r\n");
      out.write("\t</TD>\r\n");
      out.write("</TR>\r\n");

}

      out.write("\t\t\r\n");
      out.write("</TABLE>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
